using CoreManager.Models.DTOs;

namespace CoreManager.Services.Users
{
    /// <summary>
    /// 用户服务接口
    /// </summary>
    public interface IUserService
    {
        /// <summary>
        /// 获取用户列表（分页）
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="userName">用户名</param>
        /// <param name="realName">真实姓名</param>
        /// <param name="email">邮箱</param>
        /// <param name="status">状态</param>
        /// <returns></returns>
        Task<ApiResponse<PagedResponse<UserDto>>> GetUsersAsync(
            int pageIndex = 1, 
            int pageSize = 20,
            string? userName = null,
            string? realName = null,
            string? email = null,
            int? status = null);

        /// <summary>
        /// 根据ID获取用户
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <returns></returns>
        Task<ApiResponse<UserDto>> GetUserByIdAsync(int id);

        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="createDto">创建用户DTO</param>
        /// <param name="currentUserId">当前操作用户ID</param>
        /// <returns></returns>
        Task<ApiResponse<UserDto>> CreateUserAsync(CreateUserDto createDto, int currentUserId);

        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <param name="updateDto">更新用户DTO</param>
        /// <param name="currentUserId">当前操作用户ID</param>
        /// <returns></returns>
        Task<ApiResponse<UserDto>> UpdateUserAsync(int id, UpdateUserDto updateDto, int currentUserId);

        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <param name="currentUserId">当前操作用户ID</param>
        /// <returns></returns>
        Task<ApiResponse<bool>> DeleteUserAsync(int id, int currentUserId);

        /// <summary>
        /// 批量删除用户
        /// </summary>
        /// <param name="ids">用户ID列表</param>
        /// <param name="currentUserId">当前操作用户ID</param>
        /// <returns></returns>
        Task<ApiResponse<bool>> BatchDeleteUsersAsync(List<int> ids, int currentUserId);

        /// <summary>
        /// 重置用户密码
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <param name="newPassword">新密码</param>
        /// <param name="currentUserId">当前操作用户ID</param>
        /// <returns></returns>
        Task<ApiResponse<bool>> ResetPasswordAsync(int id, string newPassword, int currentUserId);

        /// <summary>
        /// 切换用户状态
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <param name="status">状态</param>
        /// <param name="currentUserId">当前操作用户ID</param>
        /// <returns></returns>
        Task<ApiResponse<bool>> ToggleUserStatusAsync(int id, int status, int currentUserId);

        /// <summary>
        /// 分配用户角色
        /// </summary>
        /// <param name="assignDto">用户角色分配DTO</param>
        /// <param name="currentUserId">当前操作用户ID</param>
        /// <returns></returns>
        Task<ApiResponse<bool>> AssignUserRolesAsync(AssignUserRolesDto assignDto, int currentUserId);

        /// <summary>
        /// 获取用户的角色列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        Task<ApiResponse<List<RoleDto>>> GetUserRolesAsync(int userId);
    }
}

